package com.smart.mobile.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.smart.model.mobile.AddressInfo;
import com.smart.util.DBUtil;

public class AddressAddDAO {
	public AddressInfo address;
	public AddressAddDAO(AddressInfo address){
		this.address = address;
	}
	public boolean AddressAdd(){
		String sql = "INSERT INTO address VALUE(?,?,?,?,?,?)";
		Connection conn=DBUtil.getConnection();
		try {
			PreparedStatement pSt = conn.prepareCall(sql);
			pSt.setInt(1, address.getId());
			pSt.setInt(2, address.getUserid());
			pSt.setString(3,address.getName());
			pSt.setString(4,address.getPhonenumber());
			pSt.setString(5,address.getBuilding());
			pSt.setString(6,address.getHousenumber());
			if(pSt.executeUpdate()<=0)
				return false;
			else return true;
		} catch (SQLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			return false;
		}
	}
}
